package com.csmht.tododemo.controller.admin;

import com.csmht.tododemo.annotation.RoleIntercept;
import com.csmht.tododemo.pojo.dto.CommentPageDTO;
import com.csmht.tododemo.pojo.dto.ToDoDTO;
import com.csmht.tododemo.pojo.entity.Todo;
import com.csmht.tododemo.pojo.enumeration.RoleEnum;
import com.csmht.tododemo.pojo.vo.ToDoVO;
import com.csmht.tododemo.result.PageResult;
import com.csmht.tododemo.result.Result;
import com.csmht.tododemo.service.TodoService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("adminTodoController")
@RequestMapping("/admin/todo")
@Slf4j
@RoleIntercept(roles = {RoleEnum.ADMIN})
public class TodoController {

    @Resource
    private TodoService todoService;

    @GetMapping
    public PageResult<ToDoVO> getAll(CommentPageDTO commentPageDTO){
        List<ToDoVO> ans = todoService.getAll(commentPageDTO);
        return PageResult.success(ans);
    }




}
